package fr.umlv.projet.android.messaging;

import android.app.IntentService;
import android.content.Intent;
import android.widget.Toast;
import fr.umlv.projet.android.utils.ServerHelper;

public class MessagingService extends IntentService{
	
	public MessagingService() {
		super("Message Service");
	}

	@Override
	protected void onHandleIntent(Intent intent) {
		String message = intent.getStringExtra("message");
		String exam = intent.getStringExtra("exam");
		try {
			ServerHelper.sendMessage(exam, message);
		} catch (Exception e) {
			Toast.makeText(getBaseContext(), "Error when sending message", Toast.LENGTH_SHORT).show();
		}
	}

}
